﻿using System.Net;
using System.Linq;
using Daemon.Model;
using Microsoft.AspNetCore.Mvc;
using Daemon.Repository.Contract;
using System.Net.Http;
using Microsoft.AspNetCore.Http;
using Daemon.Common;
using Daemon.Service.Contract;

namespace DaemonAPI
{
    [ApiController]
    [Route("daemonApi/[controller]/[action]")]
    public class AttachmentTreeController : BaseApiController<AttachmentTree, IAttachmentTreeRepository>
    {
        private readonly IAttachmentTreeService _attachmentTreeService;

        public AttachmentTreeController(IAttachmentTreeRepository repository,
        IHttpContextAccessor httpContextAccessor,
        IAttachmentTreeService attachmentTreeService) : base(repository, httpContextAccessor)
        {
            _attachmentTreeService = attachmentTreeService;
        }

        [HttpGet]
        [Route("")]
        public ResultModel GetAttachmentTree()
        {
            var resultTree = _attachmentTreeService.GetAttachmentTree();
            return new ResultModel(HttpStatusCode.OK, "", resultTree);
        }
    }
}
